#ifndef DATE_H
#define DATE_H

#include <QString>

#define OCCUPIED true
#define AVAILABLE false

class ParkingDate {
public:
    static int nextNo; // 静态成员变量，用于递增的车位编号

    ParkingDate(const QString& id, bool st = AVAILABLE, const QString& licensePlate = "", const QString& entryTime = "", const QString& currentTime = "")
        : spot_id(id), status(st), license_plate_number(licensePlate), last_entry_time(entryTime), time(currentTime), No(nextNo++) {}

    void setOccupied(bool isOccupied) {
        status = isOccupied;
    }

    void setLicensePlateNumber(const QString& plate) {
        license_plate_number = plate;
        // 如果车牌号不为空，认为车位被占用，否则认为车位未占用
        status = !license_plate_number.isEmpty();
    }


    void setLastEntryTime(const QString& entryTime) {
        last_entry_time = entryTime;
    }

    void setCurrentTime(const QString& currentTime) {
        time = currentTime;
    }

    void setExpense(int exp) {
        expense = exp;
    }

    bool isOccupied() const {
        // 如果车牌号不为空，返回true，表示车位被占用
        return !license_plate_number.isEmpty();
    }

    QString getSpotId() const {
        return spot_id;
    }

    int getNo() const {
        return No;
    }

    int getExpense() const {
        return expense;
    }

    QString getLastEntryTime() const {
        return last_entry_time;
    }

    QString getCurrentTime() const {
        return time;
    }

    bool Getstatus() const{
        return status;
    }

private:
    int No; // 车位编号
    QString license_plate_number; // 车牌号
    QString last_entry_time; // 车辆进入的时间
    QString time; // 当前时间
    int expense;//费用
    QString spot_id; // 车位id
    bool status; // 车位是否占用 "occupied" / "available"
};

#endif // DATE_H
